<?php

require_once "include.php";

if($method == "GET"){

	if($user_id = $_REQUEST["user_id"]){
		$query = "SELECT image FROM user WHERE id=$user_id";
		
		$result = mysql_query($query) or die(mysql_error());  

		while($row = mysql_fetch_array( $result )){
			header( "Location: http://soledroid.huytoan.com/images/users/" . $row["image"]);
		}
	}
	else if($canteen_id = $_REQUEST["canteen_id"]){
		$query = "SELECT image FROM canteen WHERE id=$canteen_id";
		
		$result = mysql_query($query) or die(mysql_error());  

		while($row = mysql_fetch_array( $result )){
			header( "Location: http://soledroid.huytoan.com/images/canteens/" . $row["image"]);
		}
	}
	else if($stall_id = $_REQUEST["stall_id"]){
		$query = "SELECT image FROM stall WHERE id=$stall_id";
		
		$result = mysql_query($query) or die(mysql_error());  

		while($row = mysql_fetch_array( $result )){
			header( "Location: http://soledroid.huytoan.com/images/stalls/" . $row["image"]);
		}
	}
	else if($dish_id = $_REQUEST["dish_id"]){
		$query = "SELECT image FROM dish WHERE id=$dish_id";
		
		$result = mysql_query($query) or die(mysql_error());  

		while($row = mysql_fetch_array( $result )){
			header( "Location: http://soledroid.huytoan.com/images/dishes/" . $row["image"]);
		}
	}
		
}

?>